<script type="text/javascript">
$(document).ready(function(){
    $('.popup').addClass("popup_2"); 
    
    $('.closes').click(function(){
        $('.popup').addClass("popup_2").removeClass('popup_1').addClass('popup_2');
    });
});

function tambah_peneliti(a){
    document.getElementById('angg').value = a;
    $('.popup').addClass("popup_1").removeClass('popup_2').addClass('popup_1');
}

function tambah_submit(id,nidn,nama){
    //alert(id);
    baris =  document.getElementById('angg').value;
    $('.popup').addClass("popup_2").removeClass('popup_1').addClass('popup_2');
    document.getElementById('id_pen_form'+baris).value = id;
    document.getElementById('ang_form'+baris).value = nidn+' | '+nama;
}

</script>

<div class="popup">
    <div class="popup_930px">
        
        <div class="popup_head">
            <h3>PILIH ANGGOTA PENELITIAN</h3>
            <div class="closes"></div>
        </div>
        <div class="popup_isi">
            <input id="angg" type="hidden" name="anggota" value="" />
            <table class="tabel_theme">
                <thead>
                    <tr>
                        <td style="width: 20px">No</td>
                        <td style="width: 180px">NIP</td>
                        <td style="width: 120px">NIDN</td>
                        <td style="width: 230px">NAMA</td>
                        <td style="width: 180px">JURUSAN</td>
                        <td style="width: 100px"></td>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td></td>
                        <td><input type="text" name="nip" value="" /></td>
                        <td><input type="text" name="nidn" value="" /></td>
                        <td><input type="text" name="nama" value="" /></td>
                        <td>
                            <select  type="text" name="jurusan">
                                <option value="" selected>Semua Jurusan</option>
                                <?php foreach ($list_jurusan->result() as $r) { ?>
                                    <option value="<?php echo $r->JURUSAN_ID; ?>"><?php echo $r->FAKULTAS_NAMA_SINGKATAN; ?> - <?php echo $r->JURUSAN_NAMA; ?></option>
                                <? } ?>
                            </select>
                        </td>
                        <td></td>
                    </tr>
                    <?php $a=1; foreach ($data_peneliti_all->result() as $p) { ?>
                        <tr>
                            <td><?php echo $a; ?></td>
                            <td><?php echo $p->PENELITI_NIP; ?></td>
                            <td><?php echo $p->PENELITI_NIDN; ?></td>
                            <td><?php echo $p->PENELITI_NAMA; ?></td>
                            <td><?php echo $p->JURUSAN_NAMA; ?></td>
                            <td>
                                <input onclick="tambah_submit(<?php echo $p->PENELITI_ID; ?>,<?php echo $p->PENELITI_NIDN; ?>,'<?php echo $p->PENELITI_GELAR_DEPAN." ".$p->PENELITI_NAMA." ".$p->PENELITI_GELAR_BELAKANG; ?>')" type="submit" value="Tambahkan"/>
                            </td>
                        </tr>
                    <?php $a++; } ?>
                </tbody>
            </table>
            
            
        </div>
    </div>
</div>
<div class="kontent_box">
    <div class="kontent_panel" id="penelitian_form">
    <div class="reg_input" >
        <?php 
                $dataskim = $data_skim->result();
                $dataprog = $data_program->result(); 
        ?>
        <form method="post" action="<?php echo site_url('member/reg_penelitian2/'.$dataskim[0]->SKIM_ID); ?>">
        <table> 
            
            <tr>
                <td id="text_"></td>
                <td ><input id="skim_id"  type="hidden" name="skim_id" value="<?php echo $dataskim[0]->SKIM_ID ?>" /></td>
            </tr>
            <tr>
                <td id="text_">Nama PROGRAM</td>
                <td ><input id="prog_nama"  type="text" name="program_nama" value="<?php echo $dataprog[0]->PROGRAM_NAMA ?>" disabled/></td>
            </tr>
            <tr>
                <td id="text_">Nama SKIM</td>
                <td ><input id="skim_nama"  type="text" name="skim_nama" value="<?php echo $dataskim[0]->SKIM_NAMA ?>" disabled/></td>
            </tr>
            <tr>
                <td id="text_">Judul Penelitian*</td>
                <td ><input  type="text" name="judul" value="" /></td>
            </tr>
            <tr>
                <td></td>
                <td class="eror_td2" ><?php echo form_error('judul'); ?></td>
            </tr>
            <tr>
                <td id="text_">Abstraksi Penelitian*</td>
                <td ><textarea style="height: 350px"  type="text" name="abstr" value="" ></textarea></td>
            </tr>
            <tr>
                <td></td>
                <td class="eror_td2" ><?php echo form_error('abstr'); ?></td>
            </tr>
            <tr>
                <td id="text_">Ketua Penelitian*</td>
                <?php $ketua = $data_peneliti->result(); ?>
                <td >
                    <input  type="text" name="ketuanama" value="<?php echo $ketua[0]->PENELITI_NIDN." | ".$ketua[0]->PENELITI_GELAR_DEPAN." ".$ketua[0]->PENELITI_NAMA." ".$ketua[0]->PENELITI_GELAR_BELAKANG ?>" disabled/>
                </td>
            </tr>
            <?php 
            for($i=1 ; $i<=$dataskim[0]->SKIM_MAX_ANGGOTA-1; $i++) { ?>
            <tr>
                <td >Anggota Penelitian <?php echo $i; ?></td>
                <td >
                    <input type="hidden" name="id_peneliti<?php echo $i; ?>" id="id_pen_form<?php  echo $i; ?>" value="" />
                    <input type="text" name="anggota<?php echo $i; ?>" id="ang_form<?php  echo $i; ?>" value="" disabled/>
                    <input type="button" value="Ganti" onclick="tambah_peneliti(<?php  echo $i; ?>)" />
                </td>
            </tr>
            <?php } ?>
            <tr>
                <td id="text_">Biaya Tahun 1*</td>
                <td ><input  type="text" name="biaya1" value="" /></td>
            </tr>
            <tr>
                <td></td>
                <td class="eror_td2" ><?php echo form_error('biaya1'); ?></td>
            </tr>
            <tr>
                <td id="text_">Biaya Tahun 2</td>
                <td ><input  type="text" name="biaya2" value="" /></td>
            </tr>
            <tr>
                <td id="text_">Biaya Tahun 3</td>
                <td ><input  type="text" name="biaya3" value="" /></td>
            </tr>
            <tr>
               <td id="text_">Luaran penelitian</td>
               <td ><textarea style="height: 150px"  type="text" name="luaran" value="" ></textarea></td>
            </tr>
            <tr>
                <td></td>
                <td class="eror_td2" ><?php echo form_error('luaran'); ?></td>
            </tr>
            <tr>
                <td></td>
                <td><input  type="submit" value="Daftar"/></td>
            </tr>
        </table>
         </form>
    </div>
    </div>